<template>
	<div class="theme">
		<van-nav-bar :title="$t('Lang.v1')" :left-text="$t('MyDividend.v6')" left-arrow @click-left="onClickLeft" />
		<div class="overlay headTop">
			<div class="overlay-content" style="padding-top: 10px;">
				<van-radio-group v-model="radio">
					<van-cell-group>
						<van-cell title="简体中文" clickable @click="change('1')">
							<van-radio slot="right-icon" name="1" checked-color="#3ca76d" />
						</van-cell>
						<van-cell title="English" clickable @click="change('2')">
							<van-radio slot="right-icon" name="2" checked-color="#3ca76d" />
						</van-cell>
					</van-cell-group>
				</van-radio-group>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				radio: '1'
			}
		},
		mounted() {
			localStorage.leng ? this.radio = localStorage.leng : '1';
		},
		methods: {
			change(i) {
				localStorage.leng = i;
				this.radio = localStorage.leng;
				if(i == '1') {
					this.$i18n.locale = 'cn';
					this.axios.defaults.headers.common['Language'] = 'zh_CN';
				} else if(i == '2') {
					this.$i18n.locale = 'en';
					this.axios.defaults.headers.common['Language'] = 'en_US';
				}
			},
			onClickLeft() {
				this.$router.back(-1);
			}
		}
	}
</script>

<style lang="less" scoped>
	.van-hairline--bottom::after {
		border: 0;
	}
</style>